// 测试数组变量名是否被当作地址
int test01() {
    int a[3];
    int *p = a;
    *p = 1;
    *(p+1) = 2;
    *(p+2) = 3;

    return *(a+1);
}

// 测试数组变量名加法
int test02() {
    int a[3];
    *a = 1;
    *(a+1) = 2;
    *(a+2) = 3;

    return *(a+2);
}

// 测试二维数组
int test03() {
    int arr[3][4];
    int *a = &arr;
    *a = 0;
    *(a+1) = 1; 
    *(a+2) = 2;
    *(a+3) = 3;
    *(a+4) = 4;
    *(a+5) = 5;
    *(a+6) = 6;
    *(a+7) = 7;
    *(a+8) = 8;
    *(a+9) = 9;
    *(a+10) = 10;
    *(a+11) = 11;

    return *(*arr+11);
}

// 测试一维数组索引访问
int test04() {
    int x[3];

    int *a = &x;
    *a = 0;
    *(a+1) = 1; 
    *(a+2) = 2;
    return a[2];
}

// 测试二维数组索引访问
int test05() { 
    int x[2][3];
    int *a = &x;
    *a = 0;
    *(a+1) = 1; 
    *(a+2) = 2;
    *(a+3) = 3;
    *(a+4) = 4;
    *(a+5) = 5;

    return x[1][2];
}

// 测试数组索引取值
int test06() { 
    int x[2];
    x[0] = 200;
    int *a = &x[0];
    return *a;
}

// 测试数组size
int testArraySize1d() { 
    int x[2];
    return sizeof x;
}
int testArraySize2d() { 
    int x[2][3];
    return sizeof x;
}




int main() {
    assert(2, test01());
    assert(3, test02());
    assert(11, test03());
    assert(2, test04());
    assert(5, test05());
    assert(200, test06());
    assert(8,testArraySize1d());
    assert(2*3*4,testArraySize2d());
}